package com.baymax.lib.key

import android.view.KeyEvent

interface KeyTransformer {

    /**
     * 按键配置项
     */
     val config: KeyProcessorConfig

    fun enable(): Boolean


    /**
     * 过滤的按键。过滤的键不停止后续输入。
     */
    fun filter(keyEvent: KeyEvent): Boolean

    /**
     * 期望的案件。不符合的会结束匹配
     */
    fun except(keyEvent: KeyEvent): Boolean


    /**
     * 开始匹配
     */
    fun onPickStart(keySession: KeySession)

    /**
     * 匹配结束返回
     * 可以是成功匹配
     * 也可以是输入超时自动结束
     * [keySession]保存的按键信息
     */
    fun onPickEnd(keySession: KeySession)


    /**
     * 匹配成功先执行[onPickSuccess]再执行[onPickEnd]
     */
    fun onPickSuccess(keySession: KeySession , list: List<KeyEvent>)

    /**
     * 检查按键是否满足完成条件,满足则返回list
     */
    fun checkComplete(keySession: KeySession): List<KeyEvent>?
    fun onPickContinue(keySession: KeySession)

}